import Me from '../dll/me'
import { mapGetters, mapMutations } from 'vuex'
export default {
  data () {
    return {
    }
  },
  computed: {
    ...mapGetters(['defaultAddress'])
  },
  methods: {
    ...mapMutations(['getDefaultAddress']),

    // 添加到购物车
    async onAddCart (goods_id, goods_sku, goods_sku_number = 1) {
      this.$vux.loading.show({ text: '购物车加入中...' })
      let res = await Me.addCart(goods_id, goods_sku, goods_sku_number)
      this.$vux.loading.hide()
      if (res.code == 0) {
        this.GET_GOODS_NUM()
        this.$vux.alert.show({
          title: '提示',
          content: '加入购物车成功'
        })
      } else {
        this.$vux.alert.show({
          title: '提示',
          content: res.msg
        })
      }
    }
  }
}
